import sys

class Solution(object):
    def findPeakElement(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        length = len(nums)
        nums.append(-sys.maxsize)
        for i in range(length):
            if nums[i]>nums[i-1] and nums[i]>nums[i+1]:
                return i

print(Solution().findPeakElement([1,2,3,1]))